package com.puboot.module.admin.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.puboot.common.util.Pagination;
import com.puboot.module.admin.mapper.BizCourseMapper;
import com.puboot.module.admin.model.BizCourse;
import com.puboot.module.admin.service.BizCourseService;
import com.puboot.module.admin.vo.base.ParamEntity;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * @author ltc
 * @version 1.0
 * @date 2020/9/28 15:36
 */
@Service
@AllArgsConstructor
public class BizCourseServiceImpl  extends ServiceImpl<BizCourseMapper, BizCourse> implements BizCourseService {
    private final BizCourseMapper bizCourseMapper;
    @Override
    public List<BizCourse> selectCourses(BizCourse bizCourse) {
        List<BizCourse> bizCourses = bizCourseMapper.PageCourses(null, bizCourse);
        return bizCourses;
    }

    @Override
    public IPage<BizCourse> PageCourses(BizCourse bizCourse, Integer pageNumber, Integer pageSize) {
        IPage<BizCourse> page = new Pagination<>(pageNumber, pageSize);
        return page.setRecords(bizCourseMapper.PageCourses(page, bizCourse));
    }

    @Override
    public int deleteBatch(Integer[] ids) {
        return bizCourseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    @Override
    public List<ParamEntity> getCourseList() {
        return bizCourseMapper.getCourseList();
    }
}
